providerIndex["goodsearch"] = 15;
providerIndex["yandex"] = 16;
providerIndex["naver"] = 17;
providerIndex["youku"] = 18;
providerIndex["hulu"] = 19;
providerIndex["baidu"] = 20;
providerIndex["pg"] = 22;
providerIndex["dgp"] = 23;
providerIndex["dogpile"] = 23;
providerIndex["spock"] = 23;
providerIndex["foodista"] = 24;
providerIndex["yelp"] = 25;

var goodsearch;
var yandex;
var naver;
var youku;
var hulu;
var baiduholder;
var pg;
var dgp;
var foodista;
var yelp;

function BuildMoreProviders()
{
    goodsearch = new providerObject( "goodsearch", 15, 
                                     "http://www.goodsearch.com/favicon.ico",
                                     "/images/goodsearch.gif",
                                     "http://www.goodsearch.com/Search.aspx?Keywords=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     null, 
                                     "/goodsearch.php?q=",
                                     feedTypes.local); 

    goodsearch.BuildDiv();

    providers["goodsearch"] = goodsearch;
    allProviders[allProviders.length] = goodsearch;
    providerLookup[providerIndex.goodsearch] = goodsearch;

    yandex = new providerObject( "yandex", 16, 
                                     "http://www.yandex.com/favicon.ico",
                                     "/images/yandex.png",
                                     "http://yandex.ru/yandsearch?stpar2=%2Fh1%2Ftm295%2Fs3&stpar4=%2Fs3&stpar1=%2Fu0&text=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "yandex.ru", 
                                     "http://suggest.yandex.ru/suggest-ya.cgi?ct=text/html&part=",
                                     feedTypes.external); 

    yandex.BuildDiv();

    providers["yandex"] = yandex;
    allProviders[allProviders.length] = yandex;
    providerLookup[providerIndex.yandex] = yandex;

    naver = new providerObject( "naver", 17, 
                                     "http://soovle.com/images/naverfav.ico",
                                     "/images/naver.gif",
                                     "http://search.naver.com/search.naver?where=nexearch&sm=top_sug&fbm=1&ie=utf8&query=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "naver.com", 
                                     "http://ac.search.naver.com/autocompl?frm=nx&r=1&m=0&q=",
                                     feedTypes.external); 

    naver.BuildDiv();

    providers["naver"] = naver;
    allProviders[allProviders.length] = naver;
    providerLookup[providerIndex.naver] = naver;

    youku = new providerObject( "youku", 18, 
                                     "http://soovle.com/images/youkufav.ico",
                                     "/images/youku.jpg",
                                     "http://so.youku.com/search_video/q_",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "youku.com", 
                                     "/youku.php?q=",
                                     feedTypes.local); 

    youku.BuildDiv();

    providers["youku"] = youku;
    allProviders[allProviders.length] = youku;
    providerLookup[providerIndex.youku] = youku;

    hulu = new providerObject( "hulu", 19, 
                                     "http://www.hulu.com/favicon.ico",
                                     "/images/hulu.jpg",
                                     "http://www.hulu.com/videos/search?query=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "hulu.com", 
                                     "/hulu.php?q=",
                                     feedTypes.local); 

    hulu.BuildDiv();

    providers["hulu"] = hulu;
    allProviders[allProviders.length] = hulu;
    providerLookup[providerIndex.hulu] = hulu;

    baiduholder = new providerObject( "baidu", 20, 
                                     "http://soovle.com/images/baidufavicon.ico",
                                     "/images/baidu.gif",
                                     "http://www.baidu.com/s?wd=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "baidu.com", 
                                     "http://suggestion.baidu.com/su?p=3&t=999999999999&wd=",
                                     feedTypes.external); 
    baiduholder.enc = "gb2312";
    baiduholder.BuildDiv();
    providers["baidu"] = baiduholder;
    allProviders[allProviders.length] = baiduholder;
    providerLookup[providerIndex.baidu] = baiduholder;

    bn = new providerObject( "bn", 21, 
                                     "http://4.bp.blogspot.com/-XUTWDPyxY00/U_fbJ-Di6FI/AAAAAAAACWE/TozRtOutu6E/s1600/favicon.ico",
                                     "http://2.bp.blogspot.com/-N6aBh98E2Mk/U_fabkImrKI/AAAAAAAACV8/0I77LXE9_nA/s86/bn_logo.gif",
                                     "http://books.barnesandnoble.com/search/results.aspx?afsrc=1&lkid=J12871747&pubid=K209861&WRD=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "barnesandnoble.com", 
                                     "http://autocomplete.barnesandnoble.com/autosuggest/asr.aspx?callback=updateBn&q=",
                                     feedTypes.external); 
    bn.BuildDiv();
    providers["bn"] = bn;
    allProviders[allProviders.length] = bn;
    providerLookup[providerIndex.bn] = bn;

    pg = new providerObject( "pg", 22, 
                                     "http://soovle.com/images/pgfav.ico",
                                     "/images/pgLogo.gif",
                                     "http://www.pricegrabber.com/tiger/products.html/form_keyword=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "pricegrabber.com", 
                                     "http://www.soovle.com/pg.php?q=",
                                     feedTypes.local); 
    pg.BuildDiv();
    providers["pg"] = pg;
    allProviders[allProviders.length] = pg;
    providerLookup[providerIndex.pg] = pg;

    dgp = new providerObject( "dogpile", 23, 
                                     "http://ttl30d.images.infospace.com.edgesuite.net/search/images/200902/favicon.ico",
                                     "/images/dogpile.gif",
                                     "http://www.dogpile.com/dogpile_other/ws/results/Web/tile/1/417/TopNavigation/Relevance/iq=true/zoom=off/_iceUrlFlag=7?_IceUrl=true",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "dogpile.com", 
                                     "http://suggest.infospace.com/QuerySuggest/SuggestServlet?reqID=JscriptId"+(new Date().getTime())+"&prefix=",
                                     feedTypes.external); 
    dgp.BuildDiv();
    providers["dogpile"] = dgp;
    providers["spock"] = dgp;
    allProviders[allProviders.length] = dgp;
    providerLookup[providerIndex.dgp] = dgp;

    foodista = new providerObject( "foodista", 24, 
                                     "http://www.foodista.com/favicon.ico",
                                     "http://static.foodista.com/images/logo_curved2.png",
                                     "http://www.foodista.com/search?query=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "foodista.com", 
                                     "http://soovle.com/foodista/complete.php?q=",
                                     feedTypes.local); 
    foodista.BuildDiv();
    providers["foodista"] = foodista;
    allProviders[allProviders.length] = foodista;
    providerLookup[providerIndex.foodista] = foodista;

    yelp = new providerObject( "yelp", 24, 
                                     "http://www.yelp.com/favicon.ico",
                                     "/images/yelp.png",
                                     "http://www.yelp.com/search?find_desc=",
                                     "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&context=&callback=InsertGoogleResults&start=0&rsz=small&q=", 
                                     "yelp.com", 
                                     "http://soovle.com/yelp.php?q=",
                                     feedTypes.local); 
    yelp.BuildDiv();
    providers["yelp"] = yelp;
    allProviders[allProviders.length] = yelp;
    providerLookup[providerIndex.yelp] = yelp;
}

function gdsearch(data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#goodsearchcomplete')[0];
   var suggestionImg = $('#goodsearchimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length > 1 )
   {
       terms = data[1];
       log("Terms: " + terms);
   }

   completions[providerIndex.goodsearch] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term, providerIndex.goodsearch);
       completions[providerIndex.goodsearch][termCt] = div;
   }
}

var suggest = new Object();
suggest.apply = function (data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#yandexcomplete')[0];
   var suggestionImg = $('#yandeximg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length > 1 )
   {
       terms = data[1];
       log("Terms: " + terms);
   }

   completions[providerIndex.yandex] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term, providerIndex.yandex);
       completions[providerIndex.yandex][termCt] = div;
   }
}

function set_cc(nodata, data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#navercomplete')[0];
   var suggestionImg = $('#naverimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length > 1 )
   {
       terms = data;
       log("Terms: " + terms);
   }

   completions[providerIndex.naver] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term, providerIndex.naver);
       completions[providerIndex.naver][termCt] = div;
   }
}
function ac_show() {};
var qs_ac_id = null;

function updateYouku(data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#youkucomplete')[0];
   var suggestionImg = $('#youkuimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length > 1 )
   {
       terms = data;
       log("Terms: " + terms);
   }

   completions[providerIndex.youku] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term["keyword"], providerIndex.youku);
       completions[providerIndex.youku][termCt] = div;
   }
}

function updateHulu(data)
{
   if ( !data )
    return; 
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#hulucomplete')[0];
   var suggestionImg = $('#huluimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length && data.length >= 1 )
   {
       terms = data;
       log("Terms: " + terms);
   }

   completions[providerIndex.hulu] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       if ( term && term[0])
       {
           var div = AddSuggestion(suggestionDiv, term[0], providerIndex.hulu);
           completions[providerIndex.hulu][termCt] = div;
       }
   }
}

//window.baidu.sug({q:'soo',p:true,s:['soojin','sooyuu','soogle','soon','soogou','soohu','soso','soougou' ,'soom','sougou']});
window.baidu = {};

window.baidu.sug = function ( data )
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#baiducomplete')[0];
   var suggestionImg = $('#baiduimg')[0];

    var img = $('#baiduimg')[0];
    if ( !img.seeThrough )
    {
        img.seeThrough = true;
        img.style.position = "absolute";
        $(suggestionImg).animate({opacity:".3"},300);
    }

    var gData = $('#baiducomplete');
    while ( gData.firstChild )
    {
        gData.removeChild(gData.firstChild);
    }

    var corArray = data.s;
    completions[providerIndex.baidu] = [];
    for ( var gdCt = 0; gdCt < corArray.length; gdCt++ )
    {
        var curCor = corArray[gdCt];
        var div = AddSuggestion(gData, curCor, providerIndex.baidu);
        completions[providerIndex.baidu][gdCt] = div;
    }
}

function updateBn(data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#bncomplete')[0];
   var suggestionImg = $('#bnimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data && data.match(/\|/) )
   {
        terms = data.split(/\|/g);
   }

   completions[providerIndex.bn] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term, providerIndex.bn);
       completions[providerIndex.bn][termCt] = div;
   }
}

function updatePg(data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#pgcomplete')[0];
   var suggestionImg = $('#pgimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild ) {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];

   if ( data ) {
       terms = data;
   }

   completions[providerIndex.pg] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt].keyword;
       var div = AddSuggestion(suggestionDiv, term, providerIndex.pg);
       completions[providerIndex.pg][termCt] = div;
   }
}

window.iSuggest = {};
window.iSuggest.PopulateResults=function(data,funcName) {
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#dogpilecomplete')[0];
   var suggestionImg = $('#dogpileimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild ) {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length > 1 ) {
       terms = data;
       log("Terms: " + terms);
   }

   completions[providerIndex.dgp] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term, providerIndex.dgp);
       completions[providerIndex.dgp][termCt] = div;
   }
}

function updateFoodista(data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#foodistacomplete')[0];
   var suggestionImg = $('#foodistaimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length > 0 )
   {
       terms = data;
       log("Terms: " + terms);
   }

   completions[providerIndex.foodista] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term, providerIndex.foodista);
       completions[providerIndex.foodista][termCt] = div;
   }
}

function updateYelp(data)
{
   var searchBox = $('#searchinput');
   var suggestionDiv = $('#yelpcomplete')[0];
   var suggestionImg = $('#yelpimg')[0];

   if ( !suggestionImg.seeThrough )
   {
       suggestionImg.seeThrough = true;
       suggestionImg.style.position = "absolute";
       $(suggestionImg).animate({opacity:".3"},300);
   }

   while( suggestionDiv.firstChild )
   {
       suggestionDiv.removeChild(suggestionDiv.firstChild);
   }

   var terms = [];
   if ( data.length > 0 )
   {
       terms = data;
       log("Terms: " + terms);
   }

   completions[providerIndex.yelp] = [];
   for (var termCt = 0; termCt < terms.length; termCt++ )
   {
       var term = terms[termCt];
       var div = AddSuggestion(suggestionDiv, term, providerIndex.yelp);
       completions[providerIndex.yelp][termCt] = div;
   }
}
